package be.fgmodelsport.ourbeers.adapters;

import be.fgmodelsport.ourbeers.R;
import be.fgmodelsport.ourbeers.objects.Player;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class PersonalAdapter extends ArrayAdapter<Player> {
	//private Player player;
	private Context context;
	
	public PersonalAdapter(Player player, Context context, int textViewResourceId) {
		super(context, textViewResourceId);
		this.context = context;
		this.add(player);
	}
	
	@Override
	public View getView(int position, View view, ViewGroup parent) {
		
		if (view == null ){
			LayoutInflater vi = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
			view = vi.inflate(R.layout.personal_information, null);
			//Log.d(TAG, "inflated updats view");
		}
		
		Player p = this.getItem(position);
		
		TextView txtUsername = (TextView)view.findViewById(R.id.textUsername);
		txtUsername.setText(p.getUserName());
		
		TextView txtScore = (TextView)view.findViewById(R.id.textScores);
		txtScore.setText("Score: " + p.getScore());
		
		return view;
	}
}
